We investigate the changes of the masses and widths of $\chi_{c0}$ and $\chi_{c1}$ in hot gluonic matter near $T_c$ and in nuclear medium using QCD sum rules. As in the previous works for the $J/\psi$ and $\eta_c$, in-medium effects are incorporated through the changes of gluon condensates. Twist-2 terms for the $^3 P_0 (\chi_{c0})$ and $^3 P_1 (\chi_{c1})$ are also included for the first time. The results show that larger mass shifts and width broadenings take place as compared to the $S$-wave states. As the critical change take place near $T_c$, related measurements can reveal critical phenomenon in QCD.